//导入第三方模块express返回一个方法对象调用该方法对象下的Router方法创建路由对象
const express = require('express');
//创建路由对象
const admin = express.Router();
//创建登录页路由
admin.get('/login', require('./admin/loginPage'));
//创建登录路由
admin.post('/login', require('./admin/login'));
//创建用户列表路由
admin.get('/user', require('./admin/userPage'));
//创建用户编辑页
admin.get('/user-edit', require('./admin/userEdit'));
admin.post('/user-edit', require('./admin/userEditPost'));
admin.post('/modify', require('./admin/modify'));
admin.get('/remove', require('./admin/remove'));
admin.get('/article', require('./admin/article'));
admin.get('/article-edit', require('./admin/article-edit'));
admin.post('/article-edit', require('./admin/article-edit-post'));
//删除文章
admin.post('/remove-article', require('./admin/remove-article'));
//实现文章修改功能
admin.post('/article-modify', require('./admin/article-modify'))
    //实现退出登录功能
    //1、删除session
    //2、删除cookie
    //3、重定向回'/admin/login'
admin.get('/logout', require('./admin/logout'))
module.exports = admin;